home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / edit / me_cd25.zip / MUTT2.ZIP / ME2.MUT < prev    next >
Lisp/Scheme  |  1992-11-09  |  6KB  |  193 lines

  1.   ;; me2.mut - The ME2 initialization file
  2.   ;; To compile this file: "mc2 -tme2 me2"
  3.   ;; C Durland    Public Domain
  4.  
  5.     ;; what(1) string:
  6. "@(#)me2.mut (The part of ME2 written in Mutt) v1.5 8/22/92"
  7.  
  8. (include me2.h)
  9.  
  10. (defun
  11.   center-cursor { (arg-prefix 0)(reposition-window) }
  12.   CR->CR&indent
  13.   {
  14.     (bind-local-key "newline-and-indent" "^M")
  15.     (msg "CR mapped to newline-and-indent")
  16.   }
  17.   CR->CR  { (bind-local-key "newline" "C-M") (msg "CR mapped to newline") }
  18.   cut-the-line    { (beginning-of-line)(arg-prefix 1)(cut-line) }
  19.   insert-line    { (beginning-of-line)(open-line) }
  20.   mark-and-end    { (set-mark)(end-of-buffer) }
  21.   mark-and-home    { (set-mark)(beginning-of-buffer) }
  22.   delete-current-window
  23.     { (if (not (free-window -1)) (msg "Could not delete window")) }
  24.   describe-key    ;; what is a key bound to
  25.   {
  26.     (string key bind)
  27.  
  28.     (key (ask "Key: "))
  29.     (if (== "" (bind (key-bound-to key)))(msg key " is not bound.")
  30.     (msg key " is bound to " bind))
  31.   }
  32.   rename-buffer
  33.   {
  34.     (if (not (file-name -1 (complete CC_FNAME "New file name for buffer: ")))
  35.        (msg "Could not rename buffer."))
  36.   }
  37.   not-modified { (buffer-modified -1 FALSE) }
  38.   Goto-line
  39.   {
  40.     (goto-line
  41.     (if (arg-flag) (arg-prefix) (convert-to NUMBER (ask "Goto line: "))))
  42.   }
  43.   use-existing-buffer
  44.   {
  45.     (arg-prefix 1)
  46.     (switch-to-buffer (complete CC_BUF "Use existing buffer: "))
  47.   }
  48. )
  49.  
  50. (defun
  51.   shell-region
  52.   {
  53.     (int bag-id)
  54.  
  55.     (bag-id (create-bag))
  56.     (append-to-bag bag-id APPEND-REGION)
  57.     (shell-command (bag-to-string bag-id))
  58.     (free-bag)
  59.  
  60.     (msg "[Return to resume editing]")(get-key)
  61.   }
  62. )
  63.  
  64. (const RECTANGLE-BAG 0)
  65. (defun        ;; rectangle commands
  66.   copy-rectangle  { (append-to-bag RECTANGLE-BAG APPEND-RECTANGLE) }
  67.   cut-rectangle
  68.       { (append-to-bag RECTANGLE-BAG APPEND-RECTANGLE) (erase-rectangle TRUE) }
  69.   delete-rectangle { (erase-rectangle TRUE) }
  70.   clear-rectangle  { (erase-rectangle FALSE) }
  71. )
  72.  
  73. ;; Code superseded by register.mut
  74. ;(int paste-bag-id)
  75. ;(defun        ;; my paste buffer
  76. ;  MAIN { (paste-bag-id (create-bag TRUE)) }
  77. ;  yank-paste-buffer { (insert-bag paste-bag-id) }
  78. ;  fill-paste-buffer
  79. ;    { (clear-bag paste-bag-id)(append-to-bag paste-bag-id APPEND-REGION) }
  80. ;)
  81.  
  82. (defun insert-file-name { (insert-text (complete CC_FNAME "file name: ")) })
  83.  
  84. (include modeline.mut)
  85. (include hook.mut)
  86. (include require.mut)
  87.  
  88. (include nextfile.mut)    ;; read next file from command line
  89. (include sysvar.mut)    ;; allow user to view or modify system vars
  90. (include bstats.mut)    ;; buffer stats
  91.  
  92. (include alamode.mut)    ;; set modes
  93. (include pmatch.mut)    ;; paren matching
  94. (include indent.mut)    ;; shift a region right or left
  95. (include markring.mut)    ;; a ring of marks
  96. (include hidebuf.mut)    ;; 
  97. (include register.mut)    ;; GNU's register stuff
  98. (include case.mut)    ;;
  99. (include delbuf.mut)    ;; buffer deletion
  100.  
  101. (include isearch.mut)    ;; incremental search
  102. (include search.mut)
  103. (include twiddle.mut)    ;; transpose characters
  104. (include undo.mut)    ;; undo support
  105. (include window.mut)
  106.  
  107. (include qr.mut)    ;; query replace
  108. (include popup.mut)    ;; used by query replace
  109.  
  110. (include filter.mut)    ;; filter region
  111.  
  112. (include wspace.mut)
  113.  
  114. (include autoload.mut)
  115. (defun
  116.   adjust-lines       { (autoload "adjust-lines"      "adjust"   (push-args 0)) }
  117.   calculator       { (autoload "calculator"      "calc")     }
  118.   c-mode       { (autoload "c-mode"          "cmode")    }
  119.   mutt-mode       { (autoload "mutt-mode"      "muttmode") }
  120.   text-mode       { (autoload "text-mode"      "textmode") }
  121.   pu           { (autoload "pu"          "dir"      (push-args 0)) }
  122.   cd           { (autoload "cd"          "dir"      (push-args 0)) }
  123.   pwd           { (autoload "pwd"          "dir")      }
  124.   edit-picture       { (autoload "edit-picture"      "picture")  }
  125.   mail-mode        { (autoload "mail-mode"      "mailmode") }
  126.   buffer-nomunge   { (autoload "buffer-nomunge"      "nomunge")  }
  127.   compile       { (autoload "compile"      "compile"  (push-args 0)) }
  128.   grep           { (autoload "grep"          "compile")  }
  129.   findit       { (autoload "findit"          "findit")   }
  130.   spell-buffer       { (autoload "spell-buffer"      "spell")    }
  131.   spell-region       { (autoload "spell-region"      "spell")    }
  132.   spell-word       { (autoload "spell-word"      "spell")    }
  133. )
  134.  
  135. (defun MAIN    ;; and now the init time code
  136. {
  137.   (bind-to-key "delete-whitespace"    "F-1")    ;; F1
  138.   (bind-to-key "next-buffer"        "F-2")    ;; F2
  139.   (bind-to-key "cut-the-line"        "F-5")    ;; F5
  140.   (bind-to-key "p-match"        "F-6")    ;; F6 in pmatch.mut
  141.   (bind-to-key "CR->CR&indent"        "F-7")    ;; F7
  142.   (bind-to-key "CR->CR"            "F-8")    ;; F8
  143.   (bind-to-key "set-the-mark"        "F-0")    ;; F10
  144.  
  145.   (bind-to-key "cut-the-line"     "F-L")    ;; delete line key on HP terminals
  146.   (bind-to-key "center-cursor"     "F-G")    ;; insert key
  147.   (bind-to-key "mark-and-end"     "F-B")    ;; end key
  148.   (bind-to-key "mark-and-home"     "F-A")    ;; home key
  149.  
  150.   (bind-to-key "twiddle-left-of-dot"    "C-t")        ;; in twiddle.mut
  151.   (bind-to-key "next-file"        "C-xf")        ;; in nextfile.mut
  152.   (bind-to-key "query-replace"        "M-q")
  153.   (bind-to-key "query-replace"        "M-%")
  154.   (bind-to-key "re-query-replace"    "M-C-q")
  155.   (bind-to-key "Goto-line"        "M-g")
  156.   (bind-to-key "delete-current-window"    "C-x0")
  157.   (bind-to-key "list-buffers"        "C-xC-b")    ;; in bstats.mut
  158.   (bind-to-key "show-buffer-stats"    "C-x=")        ;; in bstats.mut
  159.   (bind-to-key "use-existing-buffer"    "C-xC-o")
  160.  
  161.   (bind-to-key "spell-word"        "M-$")        ;; in spell.mut
  162.  
  163.  
  164.   (arg-prefix 1)(load "osstuff")    ;; load os specific ME extensions
  165.   (arg-prefix 1)(load "./mext")        ;; load directory local ME extensions
  166.  
  167.   (arg-prefix 1)(load "myme")        ;; load your personal ME extensions
  168.  
  169.   (if (not (command-line-done))    ;; Gotta process the command line myself
  170.     {
  171.       (if (!= 1 (argc))        ;; there are files on command line
  172.     (next-file)        ;; edit first file on command line
  173.     (version))        ;; stick something in the message line
  174.     })
  175.  
  176.     ;; Delete the *scratch* buffer, even if it is the only buffer.
  177.     ;; If it is the only buffer, this will cause (create-buffer-hook) to be
  178.     ;;   called.  Since *scratch* was created before this code was loaded,
  179.     ;;   (create-buffer-hook) hadn't been called.
  180.     ;; Gotta be careful - *scratch* might already be gone if this file is
  181.     ;;   loaded twice.
  182.   (if (!= -2 (attached-buffer "*scratch*"))
  183.     (free-buffer (attached-buffer "*scratch*")))
  184. })
  185.  
  186.  
  187. (bool hoodoo)
  188. (defun command-line-done ;; [(bool it-has-been-processed)]
  189. {
  190.   (if (!= 0 (nargs)) (hoodoo (arg 0)))
  191.   hoodoo
  192. })
  193.